package cn.tedu.auto.config;

import cn.tedu.auto.config.bean.LubanUser;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
//必须有一个属性 luban.user.enable 值value必须是true
@ConditionalOnProperty(prefix = "luban.user",value="enable",havingValue = "true")
public class LubanUserAutoConfiguration {
    @Bean(name="lubanUser")
    //如果使用自动配置的一方 自行配置了LubanUser 这个条件不满足
    @ConditionalOnMissingBean(LubanUser.class)
    public LubanUser initLubanUser(){
        return new LubanUser();
    }
}
